<template>
	<view class="uv-content">
		<uv-parse :content="detailsData.content"></uv-parse>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detailsData: {}
			};
		},
		onLoad() {
			this.loadData();
		},
		methods: {
			async loadData(data) {
				await uni.request({
					url: '/wanlshop/article/details',
					data: {
						id: 2
					},
					success: res => {
						//详情正则
						res.data.content = res.data.content.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (
							match, capture) => {
							var img =
								`<img style="display: block; max-width: 100%;" src="${this.$wanlshop.oss(capture, 500, 0)}">`;
							return img;
						});
						this.detailsData = res.data;
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	.uv-content {
		padding: 24rpx;
	}
</style>